import { IsJSON, IsNotEmpty, Matches, IsUrl } from 'class-validator';
export class CreateInterfaceDto {
  @IsNotEmpty({ message: '输入名称不能为空' })
  name: string;
  @IsNotEmpty({ message: '请求格式类型不能为空' })
  @Matches(/^(https?|HTTP|HTTPS):\/\/[^\s/$.?#].[^\s]*$/, {
    message: '请求url类型不正确,不是一个正常的http或https请求',
  })
  requestUrl: string;
  @IsNotEmpty({ message: '请求头不能为空' })
  requestHeader: string;
  @IsNotEmpty({ message: '请求格式类型不能为空' })
  @Matches(/^(GET|POST|PUT|PATCH|DELETE)$/i, {
    message: '请求类型只能选择GET,POST,PUT,PATCH,DELETE',
  })
  requestType: string;
  @IsNotEmpty({ message: '输入请求体不能为空' })
  requestBody: string;
  @IsNotEmpty({ message: '输入请求结果不能为空' })
  response: string;

  directoryId?: number;
}
